package com.example.constant;

import org.apache.commons.lang3.StringUtils;

public enum SeatTypeEnum {

    LOW_SEAT(Short.valueOf("1"),"抵档票座位"),
    MID_SEAT(Short.valueOf("2"),"中档票座位"),
    HIGH_SEAT(Short.valueOf("3"),"高档票座位");

    private final Short code;
    private final String value;

    SeatTypeEnum(Short code, String value) {
        this.code = code;
        this.value = value;
    }

    public Short getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据value获取code
     * @param code 代码
     * @return 返回值
     */
    public static String getValueByCode(Short code) {
        for (SeatTypeEnum seatTypeEnum : SeatTypeEnum.values()) {
            if (seatTypeEnum.getCode().equals(code)) {
                return seatTypeEnum.getValue();
            }
        }
        return StringUtils.EMPTY;
    }
}
